package sz.szsmk.citizencard.ui.activity;

import android.os.Bundle;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import android.view.WindowManager;

import com.chenenyu.router.annotation.Route;
import com.gyf.immersionbar.ImmersionBar;

import sz.szsmk.citizencard.R;
import sz.szsmk.citizencard.ui.fragment.YouzanFragment;

/**
 * Copyright (c)2018
 * author: zdh
 * created on: 2018/6/22 14:45
 * description:
 */
@Route("youzan")
public class YouzanActivity extends AppCompatActivity {
    public static final String KEY_URL = "url";
    private YouzanFragment mFragment;


    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
        initSystemBar();
        setContentView(R.layout.activity_placeholder);
//        getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
        mFragment = new YouzanFragment();
        mFragment.setArguments(getIntent().getExtras());

        getSupportFragmentManager()
                .beginTransaction()
                .replace(R.id.placeholder, mFragment)
                .commitAllowingStateLoss();
    }

    protected void initSystemBar() {
        ImmersionBar.with(this)
                .fitsSystemWindows(true)
                .statusBarDarkFont(false, 0f)
                .statusBarColor(R.color.color_2184FA).init();
    }

    @Override
    public void onBackPressed() {
        if (mFragment == null || !mFragment.onBackPressed()) {
            super.onBackPressed();
        }
    }
}
